//
//  UThemes.cpp
//  UltraStarDeluxeIOS
//
//  Created by 李 杰军 on 12-7-15.
//  Copyright (c) 2012年 DoReiMi. All rights reserved.
//

#include <iostream>
#include "UThemes.h"
#include "UPathUtils.h"
#include "UFilesystem.h"

const std::string BGT_Names[bgtNum] =
{
    "none",
    "color",
    "texture",
    "video",
    "fade",
    "auto",
};

const TThemeBackground DEFAULT_BACKGROUND =
{
    bgtColor,
    {1.0f, 1.0f, 1.0f},
    "",
    1.0f,
};

TTheme::TTheme()
{
    Loading = new TThemeLoading();
    
    LoadList();
}

TTheme::~TTheme()
{
    if (Loading) 
    {
        delete Loading;
        Loading = NULL;
    }
}

void TTheme::LoadHeader(const std::string& FileName)
{
    
}

void TTheme::LoadList()
{
    // TODO: Log logic
    
    std::string path = ThemePath;
    //path = path + "*.ini";
    
    std::vector<std::string>* themepaths = FileSystem->list(path, "*.ini", false);
    int pathNum = themepaths->size();
    for (int i = 0; i < pathNum; i++)
    {
        std::string themepath = (*themepaths)[i];
    }
    
    delete themepaths;
}

bool TTheme::LoadTheme(int ThemeNum, int sColor)
{
    int I;
    bool result = false;
    
    return result;
}

void TTheme::CreateThemeObjects()
{
    if (Loading)
    {
        delete Loading;
        Loading = NULL;
    }
    Loading = new TThemeLoading();
}

TTheme* Theme = NULL;
